import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [

   {
    title: '编号',
    align:"center",
    sorter: true,
    dataIndex: 'code'
   },
   {
    title: '名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '描述',
    align:"center",
    dataIndex: 'remark'
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'enabledStatus',
    customRender: ({ text }) => {
      return Number(text) === 1
        ? '有效' : Number(text) === 0
        ? '无效' : ''
    },
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "编号",
      field: 'code',
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "名称",
      field: 'name',
      component: 'Input',
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [

  {
    label: '时格编号',
    field: 'code',
    component: 'Input',
    rules: [
      { required: true, message: '编号不能为空！' },
    ],
  },
  {
    label: '时格名称',
    field: 'name',
    component: 'Input',
    rules: [
      { required: true, message: '名称不能为空！' },
    ],
  },
  {
    label: '时格单位',
    field: 'timeIntervalUnit',
    component: 'Select',
    componentProps:{
      options:[{value:0,label:'秒'},{value:1,label:'分'},{value:2,label:'时'},{value:3,label:'天'},{value:4,label:'周'},{value:5,label:'月'}]
    }
  },
  {
    label: '时格值',
    field: 'timeIntervalValue',
    component: 'InputNumber',
  },
  {
    label: '描述',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'enabledStatus',
    component: 'Select',
    defaultValue:0,
    componentProps:{
        options:[{value:0,label:'无效'},{value:1,label:'有效'}],
        stringToNumber: true,
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}